class LoginController < ApplicationController
  def index
  end

  def validate
    @username = params[:user_name]
    @password = params[:password]
    puts '********************************** '
    printf 'user_name =%s',@username
    @user = User.where("user_name = ?",@username)

    if @user.size <=0
      flash[:notice] = "Please input correct name or password"
      redirect_to :action => "index"
    else
      session[:username]=@username
    end
  end
end
